#include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using i128 = __int128;
const int N = 1e6 + 5;

// 计算n的二进制的1的个数
void solve() {
    ll n;
    cin >> n;
    int cnt = 0;
    ll temp = n;
    while (temp) {
        cnt += temp & 1;
        temp >>= 1;
    }
    cout << cnt << " " << (1ll << cnt) - 1 << endl;
    return;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int t;
    cin >> t;
    while (t--) solve();

    return 0;
}